package www.rlicker.service.impl;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import www.rlicker.dao.IAgentUserDao;
import www.rlicker.model.AgentUser;
import www.rlicker.mybatis.Criteria;
import www.rlicker.service.IAgentUserService;
import www.rlicker.utils.MessageConstant;
import www.rlicker.utils.TranslateToMap;


@Service
public class AgentUserServiceImpl implements IAgentUserService{


	public List<Map<String, Object>>  queryPage (Criteria<AgentUser> param){
		List<AgentUser> list = agentUserRepository.queryPage(param);
		List<Map<String,Object>> map = TranslateToMap.convertListBean2ListMap(list,AgentUser.class);
	return map;  }

	public Integer queryPageCount (Criteria<AgentUser> param){
		return (Integer) agentUserRepository.queryPageCount(param);
	}

	public AgentUser  queryEntity (Integer id ){
		return agentUserRepository.queryEntity(id);
	}

	public String deleteById (Integer id ){
		int result = agentUserRepository.deleteById(id);
			if ( result != 1) {
					return MessageConstant.USER_TYPE_3;
			}
			return null;
	}

	public String insert(AgentUser record ){
		int result = agentUserRepository.insert(record);
			if ( result != 1) { 
					return MessageConstant.USER_TYPE_4;
			}
			return null;
	}

	public String update (Criteria<AgentUser> param){
		int result = agentUserRepository.update(param);
			if ( result != 1) { 
					return MessageConstant.USER_TYPE_5;
			}
			return null;
	}

	@Resource
	private IAgentUserDao agentUserRepository;

}